<template>
    <div>
        <h2 style="text-align: center;">医生列表</h2>
        <el-table
                :data="tableData.filter(data => !search || data.name.toLowerCase().includes(search.toLowerCase())||data.idCard.toLowerCase().includes(search.toLowerCase())||data.date.toLowerCase().includes(search.toLowerCase()))"
                style="width: 83%">
            <el-table-column
                    label="编号"
                    prop="id">
            </el-table-column>
            <el-table-column
                    label="姓名"
                    prop="name">
            </el-table-column>
            <el-table-column
                    label="性别"
                    prop="sex">
            </el-table-column>
            <el-table-column
                    label="身份证号"
                    prop="idCard">
            </el-table-column>
            <el-table-column
                    label="电话"
                    prop="phone">
            </el-table-column>
            <el-table-column
                    label="科室"
                    prop="department">
            </el-table-column>
            <el-table-column
                    align="right">
                <template slot="header" slot-scope="scope">
                    <el-input
                            v-model="search"
                            size="mini"
                            placeholder="输入关键字搜索"/>
                </template>
                <template slot-scope="scope">
                    <el-button
                            size="mini"
                            type="danger"
                            @click="handlePay(scope.$index, scope.row)">详情</el-button>
                    <el-button
                            size="mini"
                            type="danger"
                            @click="handlePay(scope.$index, scope.row)">开除</el-button>
                </template>
            </el-table-column>
        </el-table>
    </div>
</template>

<script>
    export default {
        name: "donate",
        data() {
            return {
                tableData: [{
                    id: '001',
                    name: '李刚',
                    sex:'男',
                    idCard:'4423698562458',
                    phone:'12315456534',
                    department: '妇产科'
                }, {
                    id: '002',
                    name: '王敏',
                    sex:'女',
                    idCard:'442369846456458',
                    phone:'12315456534',
                    department: '皮肤科'
                }, {
                    id: '003',
                    name: '王宝',
                    sex:'男',
                    idCard:'44236156598562458',
                    phone:'12315456534',
                    department: '精神科'
                }, {
                    id: '007',
                    name: '张三',
                    sex:'男',
                    idCard:'42615323698562458',
                    phone:'12315456534',
                    department: '放射科'
                }],
                search: ''
            }
        },
        methods: {
            handlePay(index, row) {
                console.log(row.name);
                this.$router.push({name:'PayPage',params:{name:row.name}});
            }
        },
    }
</script>

<style scoped>

</style>